package com.itheima.mysream;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class StreamDemo1 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //编码
        String str1 = "ai你哦";
        byte[] bytes1 = str1.getBytes();
        System.out.println(Arrays.toString(bytes1));


        String str2 = "ai你哦";
        byte[] bytes2 = str2.getBytes("GBK");
        System.out.println(Arrays.toString(bytes2));

        //解码
        String str3 = new String(bytes1);
        System.out.println(str3);

        String str4 = new String(bytes2,"GBK");
        System.out.println(str4);
    }
}
